package suncertify.view;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


/**
 * asynchronously implementation of ActionListener
 */
public abstract class AsyncActionListener implements ActionListener {
    /**
     * Invoked when an action occurs. This method start new thread, which is executed doAction method
     * @param event occured event
     */
    public final void actionPerformed(final ActionEvent event) {
        Thread t = new Thread(new Runnable() {
            public void run() {
                doAsync(event);
            }
        });
        t.start();
    }

    /**
     * perform an action processing in separate thread
     * @param event occurred event
     */
    public abstract void doAsync(ActionEvent event);
}
